<template>
    <div>
        <el-container style="height: 100vh;">
            <el-header style="background-color: antiquewhite; line-height: 60px;">
                <el-col :span="1" style="height: 60px; margin-left: 10px;"><el-image style="width: 60px; height: 60px;"
                        :src="logoUrl"></el-image></el-col>
                <el-col :span="4">
                    蜗牛共享车位出租客端
                </el-col>
            </el-header>
            <el-container style="height: 100vh;">
                <el-aside width="200px" style="background-color: aquamarine;">
                    <el-row class="tac" style="height: 100%; width: 100%;">
                        <el-col :span="24" style="height: 100%; width: 100%;">
                            <el-menu default-active="2" class="el-menu-vertical-demo" @open="handleOpen"
                                @close="handleClose" style="height: 100%; width: 100%;" router>
                                <el-menu-item @click="handleItemClick('RentersInfoIdCard')" index="RentersInfoIdCard">
                                    <i class="el-icon-set-up"></i>
                                    <span slot="title">个人信息管理</span>
                                </el-menu-item>
                                <el-menu-item index="RentersCarcerApply">
                                    <i class="el-icon-truck"></i>
                                    <span slot="title">车位物业申请</span>
                                </el-menu-item>
                                <el-menu-item index="RentersCarinfo">
                                    <i class="el-icon-truck"></i>
                                    <span slot="title">查询我的车位</span>
                                </el-menu-item>
                            </el-menu>
                        </el-col>
                    </el-row>
                </el-aside>
                <el-main>
                    <router-view />
                </el-main>
            </el-container>
        </el-container>
    </div>
</template>

<script>
import router from '../router';

export default {
    name: "RentersIndex",
    data() {
        return {
            logoUrl: "../../static/images/system/woniu.png"
        };
    },
    methods: {
        handleItemClick(index) {
            this.$http.get("/renters/rentersInfo/loadAllRentersInfoss")
                .then(resp => {
                    const result = resp.data;
                    if (index === 'RentersInfoIdCard') {
                        console.log(result)
                        if (result==true) {
                            this.$router.push('/RentersInfo');
                        } else {
                            this.$router.push('/RentersInfoIdCard');
                        }
                    }
                })
                .catch(error => {
                    console.error("请求出错：", error);
                });
        },
        handleOpen(key, keyPath) {
            console.log(key, keyPath);
        },
        handleClose(key, keyPath) {
            console.log(key, keyPath);
        }
    },
    created() {
    },
    components: { router }
}
</script>

<style scoped>
html,
body {
    height: 100%;
}
</style>